<?php
    require('conn.php');
    if(isset($_POST['save'])){;
        $username = $_POST['username'];
        $email = $_POST['email'];
        $mobile = $_POST['mobile'];
    }
    //收集从insert。html post 提交的数据
        //注释

    //echo $username.$email.$mobile;

    //获取的数据插入到数据库 
    //构造一个sql语句

    //注释
    $sql = "insert into users(name,email,mobile) values('$username','$email','$mobile')";
    
    if (mysqli_query($link,$sql)) {
        header("Location: index.php");
        exit;
    } else {
        echo "Error:".mysqli_error($link);
    }
    
    // echo $sql;
    //返回首页
    // header("Location: index.php");
    // exit;  
?>